# coding: utf-8
from me.api_utils import *
from me.api_utils import WXAppAPIView as APIView
from .model_serializers import *


class HelpArticleAPIView(APIView):
    permission_classes = ()
    authentication_classes = ()

    def get(self, request, id):
        article = get_object_or_404(HelpArticle, id)
        return success_resp(HelpArticleSerializers(instance=article).data)


class HelpArticleListAPIView(APIView):
    permission_classes = ()
    authentication_classes = ()

    def get(self, request):
        articles = HelpArticle.objects.all().order_by('-sort_order')
        return success_resp(HelpArticleSerializers(instance=articles, many=True).data)

